package com.air.ota.vo;

import com.air.ota.util.HexStringUtil;

public class SZTBaseResponseVO extends SZTBaseRequestVO{
	
	public SZTBaseResponseVO(){
		
	}
	
	public void parse(byte[] responseBytes){
		
		
		this.pckLength = new byte[2];
		System.arraycopy(responseBytes, 0, this.pckLength, 0, 2);
		
		this.syncCode = new byte[2];
		System.arraycopy(responseBytes, 2, this.syncCode, 0, 2);
		
		this.compressMethod =  responseBytes[4];
		
		this.messageType = new byte[2];
		System.arraycopy(responseBytes, 5, this.messageType, 0, 2);
		
		this.messageVer = responseBytes[7];
		
		this.requireId = new byte[6];
		System.arraycopy(responseBytes, 8, this.requireId, 0, 6);
		
		this.destId = new byte[6];
		System.arraycopy(responseBytes, 14, this.destId, 0, 6);
		
		this.responseCode = responseBytes[20];
		
		byte[] serversTypeBytes = new byte[4];
		System.arraycopy(responseBytes, 21, serversTypeBytes, 0, 4);
		this.serversType = HexStringUtil.hex2Asc(HexStringUtil.bytesToHexString(serversTypeBytes));
		
		int dataLength = responseBytes.length-25-4;
		byte[] dataBytes = new byte[dataLength];
		System.arraycopy(responseBytes, 25, dataBytes, 0, dataLength);
		this.data = HexStringUtil.hex2Asc(HexStringUtil.bytesToHexString(dataBytes));
		
		this.mac = new byte[4];
		System.arraycopy(responseBytes, 25+dataLength, mac, 0, 4);
		
		
		
		
	}
}
